Use lazy initialization for dmd.frontend#7789
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
| */ | ||
| void initDMD() | ||
| { | ||
| import std.concurrency : initOnce; |
There was a problem hiding this comment.
We're not linking with Phobos - just druntime.
There was a problem hiding this comment.
This file uses Phobos as it isn't part of the compiler.
|
I'm afraid I don't see how this improves anything. |
|
The |
|
What happens if |
Reinitialization is not so easy due to "inaccessible" globals: here's what I had to do in my experiments for Visual D some time ago: https://github.com/rainers/visuald/blob/dmdserver/vdc/dmdserver.d#L1009 |
| Expression._init(); | ||
| Objc._init(); | ||
| builtin_init(); | ||
| static shared bool initialized; |
There was a problem hiding this comment.
The front end is not thread safe, no need to pretend it here.
I was thinking if something bad can happen if |
| import dmd.arraytypes : Strings; | ||
| import std.string : toStringz; | ||
|
|
||
| initDMD; |
There was a problem hiding this comment.
Please let's not introduce a new style for calling functions - append the ().
|
This just seems like over-engineering. Just use: Done - no import, no delegate, no dependencies, no "what does this do", etc. |
Lazy initialization seems to be the new game in town.
dmd.frontendwants to play with the big kids too!